# FROM golang:1.12.6
# ENV BASEDIR="/etcd"
# ENV DATADIR="${BASEDIR}/data"
# ENV CONFDIR="${BASEDIR}/conf"
# ENV CONFFILE="${CONFDIR}/etcd.log"
# # ENV LOGDIR="${BASEDIR}/logs"
# # ENV LOGFILE="${LOGDIR}/etcd.log"

# COPY docker/* /usr/local/bin/
# # COPY etcd /usr/local/bin/
# # COPY etcdctl /usr/local/bin/
# # COPY docker-entrypoint.sh /usr/local/bin/
# # RUN mkdir -p ${DATADIR} && mkdir -p ${LOGDIR} && echo "alias ll='ls -laF'" >> ~/.bashrc
# RUN mkdir -p ${DATADIR} && mkdir -p ${CONFDIR} && echo "alias ll='ls -laF'" >> ~/.bashrc
# WORKDIR ${BASEDIR}
# # RUN mkdir /data && chown redis:redis /data
# # VOLUME /data
# # WORKDIR /data
# EXPOSE 2379 2380
# ENTRYPOINT ["docker-entrypoint.sh"]
# # 默认启动命令
# CMD ["etcd"]

# # FROM golang:1.8

# # WORKDIR /go/src/app
# # COPY . .

# # RUN go get -d -v ./...
# # RUN go install -v ./...

# # CMD ["app"]

FROM alpine:latest
#FROM busybox:latest

COPY docker/etcd* /usr/local/bin/
COPY docker/jq-linux64 /usr/local/bin/jq
# RUN mkdir -p /var/etcd/ && \
    # mkdir -p /var/lib/etcd/ && \
RUN mkdir -p /data && echo "alias ll='ls -laF'" >> /etc/profile
# RUN mkdir -p /var/lib/etcd/
WORKDIR /data
# Alpine Linux doesn't use pam, which means that there is no /etc/nsswitch.conf,
# but Golang relies on /etc/nsswitch.conf to check the order of DNS resolving
# (see https://github.com/golang/go/commit/9dee7771f561cf6aee081c0af6658cc81fac3918)
# To fix this we just create /etc/nsswitch.conf and add the following line:
# RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf

EXPOSE 2379 2380

# Define default command.
CMD ["/usr/local/bin/etcd"]